package ivo.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import ivo.pojo.AcarristPO;
import ivo.pojo.AeqptptPO;
import ivo.pojo.AeqptstPO;
import ivo.pojo.StockerPO;
import ivo.service.impl.WfmService;
import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import ivo.util.GetSystemTime;

import com.opensymphony.xwork2.ActionSupport;

@Controller
@Scope("prototype")
public class StkAction extends ActionSupport {
	private Logger logger = Logger.getLogger(StkAction.class);

	@Autowired
	private WfmService wfmService;
	private String layout;
	private String portInfor;
	private String selData;
	private List<AcarristPO> getstkCrrList;
	private List<StockerPO> stk_stat;

	

	public List<StockerPO> getStk_stat() {
		return stk_stat;
	}

	public void setStk_stat(List<StockerPO> stk_stat) {
		this.stk_stat = stk_stat;
	}

	public String getStkLayoutInfor(){
		String jsonStr = selData;
		JSONObject jsonObj = JSONObject.fromObject(jsonStr);
		String stk_id = jsonObj.getString("stk_id");
		logger.info("本次请求的STK_id 为 : " + stk_id);
		layout = wfmService.getStkLayout(stk_id); //STK现有储位分布
		portInfor = wfmService.getPortInfor(stk_id);//STK中显示port及机台ID
		getstkCrrList = wfmService.selectDcarristStkCrrList(stk_id);//STK中CRR在储位的位置信息
		stk_stat=wfmService.selectStockerstat(stk_id);
		return SUCCESS;
	}

	public String getLayout() {
		return layout;
	}

	public void setLayout(String layout) {
		this.layout = layout;
	}

	public String getSelData() {
		return selData;
	}

	public void setSelData(String selData) {
		this.selData = selData;
	}

	public List<AcarristPO> getGetstkCrrList() {
		return getstkCrrList;
	}

	public void setGetstkCrrList(List<AcarristPO> getstkCrrList) {
		this.getstkCrrList = getstkCrrList;
	}

	public String getPortInfor() {
		return portInfor;
	}

	public void setPortInfor(String portInfor) {
		this.portInfor = portInfor;
	}

	

	
}
